package com.webbei.Backstage.action;

import java.io.IOException;

import org.apache.struts2.ServletActionContext;

import com.webbei.Backstage.service.BackstateSer;


public class checkTheBrandSeriesAction {
	private BackstateSer bao;
	private int brandId;
	private String newCarName;
	
	public String execute(){
		
		System.out.println(brandId+",..."+newCarName);
		int i=check(newCarName,brandId);
		if(i>0){
			try {
				ServletActionContext.getResponse().getWriter().write("true");
				ServletActionContext.getResponse().setContentType("text/html");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else{
			try {
				ServletActionContext.getResponse().getWriter().write("false");
				ServletActionContext.getResponse().setContentType("text/html");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return null;
	}

	public int check(String newCarName,int brandId){
		int j=0;
		j=bao.checkBrandSeries(newCarName,brandId);
		return j;
	}

	public BackstateSer getBao() {
		return bao;
	}



	public void setBao(BackstateSer bao) {
		this.bao = bao;
	}



	public int getBrandId() {
		return brandId;
	}

	public void setBrandId(int brandId) {
		this.brandId = brandId;
	}

	public String getNewCarName() {
		return newCarName;
	}

	public void setNewCarName(String newCarName) {
		this.newCarName = newCarName;
	}

	
	
}
